#include <bits/stdc++.h>
using namespace std;

int arr[100][20] = {0};

int main() {
	int n = 0, m = 0;
	double _max = 0, sum;
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> arr[i][j];
		}
	}
	for (int i = 0; i < n; ++i) {
		sort(arr[i], arr[i] + m);
	}
	for (int i = 0; i < n; ++i) {
		sum = 0;
		for (int j = 1; j < m - 1; ++j) {
			sum += arr[i][j];
		}
		if (sum * 1.0 / (m - 2) > _max) {
			_max = sum * 1.0 / (m - 2);
		}
	}
	printf("%.2lf", _max);
	return 0;
}